<?php
declare(strict_types=1);
namespace Field;

class AuthNickConst
{
    public const pk='NickID';
    public const index=['NickID'];
	public const fields=['NickID','TypeID','NickName','Name','Mobile','Status','CreateAt','UpdateAt','ShopID','UserID'];
	public const comment=['NickID'=>'ID','TypeID'=>'类型 1淘宝 2京东','NickName'=>'店铺名字','Name'=>'老板名字','Mobile'=>'老板手机号','Status'=>'状态','CreateAt'=>'','UpdateAt'=>'','ShopID'=>'店铺ID','UserID'=>'录入用户ID'];
	/*
    * @Field NickID
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key PRI
    * @Default 
    * @Extra auto_increment
    * @Privileges select,insert,update,references
    * @Comment ID
    */
    public const NickID = 'NickID';
    /*
    * @Field TypeID
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key MUL
    * @Default 1
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 类型 1淘宝 2京东
    */
    public const TypeID = 'TypeID';
    /*
    * @Field NickName
    * @Type varchar(32)
    * @Collation utf8_general_ci
    * @Null NO
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 店铺名字
    */
    public const NickName = 'NickName';
    /*
    * @Field Name
    * @Type varchar(32)
    * @Collation utf8_general_ci
    * @Null NO
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 老板名字
    */
    public const Name = 'Name';
    /*
    * @Field Mobile
    * @Type varchar(32)
    * @Collation utf8_general_ci
    * @Null NO
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 老板手机号
    */
    public const Mobile = 'Mobile';
    /*
    * @Field Status
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 状态
    */
    public const Status = 'Status';
    /*
    * @Field CreateAt
    * @Type timestamp
    * @Collation 
    * @Null YES
    * @Key 
    * @Default CURRENT_TIMESTAMP
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const CreateAt = 'CreateAt';
    /*
    * @Field UpdateAt
    * @Type timestamp
    * @Collation 
    * @Null YES
    * @Key 
    * @Default CURRENT_TIMESTAMP
    * @Extra on update CURRENT_TIMESTAMP
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const UpdateAt = 'UpdateAt';
    /*
    * @Field ShopID
    * @Type bigint(20)
    * @Collation 
    * @Null YES
    * @Key MUL
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 店铺ID
    */
    public const ShopID = 'ShopID';
    /*
    * @Field UserID
    * @Type int(11)
    * @Collation 
    * @Null YES
    * @Key MUL
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 录入用户ID
    */
    public const UserID = 'UserID';
}

class AuthNickColumns
{
public  int $NickID;
   public  int $TypeID;
   public  string $NickName;
   public  string $Name;
   public  string $Mobile;
   public  int $Status=0;
   public  ?string $CreateAt='';
   public  ?string $UpdateAt='';
   public  int $ShopID=0;
   public  int $UserID=0;
	public function toArray():array
	{
		return [
'NickID'=>$this->NickID,
    'TypeID'=>$this->TypeID,
    'NickName'=>$this->NickName,
    'Name'=>$this->Name,
    'Mobile'=>$this->Mobile,
    'Status'=>$this->Status,
    'CreateAt'=>$this->CreateAt,
    'UpdateAt'=>$this->UpdateAt,
    'ShopID'=>$this->ShopID,
    'UserID'=>$this->UserID,        ];
	}
}

class AuthNickRow
{
	public AuthNickColumns $data;
	public function toArray():array
	{
		return $this->data->toArray();
    }

    public function getValue(string $field):string|int|null
    {
        return match ($field){
        'NickID' => $this->data->NickID,
        'TypeID' => $this->data->TypeID,
        'NickName' => $this->data->NickName,
        'Name' => $this->data->Name,
        'Mobile' => $this->data->Mobile,
        'Status' => $this->data->Status,
        'CreateAt' => $this->data->CreateAt,
        'UpdateAt' => $this->data->UpdateAt,
        'ShopID' => $this->data->ShopID,
        'UserID' => $this->data->UserID, default=>null
        };
    }

    public function __construct(array $data)
    {
        $this->data = new AuthNickColumns();
        isset($data['NickID']) && $this->data->NickID = (int)$data['NickID'];
           isset($data['TypeID']) && $this->data->TypeID = (int)$data['TypeID'];
           isset($data['NickName']) && $this->data->NickName = (string)$data['NickName'];
           isset($data['Name']) && $this->data->Name = (string)$data['Name'];
           isset($data['Mobile']) && $this->data->Mobile = (string)$data['Mobile'];
           isset($data['Status']) && $this->data->Status = (int)$data['Status'];
           isset($data['CreateAt']) && $this->data->CreateAt = (string)$data['CreateAt'];
           isset($data['UpdateAt']) && $this->data->UpdateAt = (string)$data['UpdateAt'];
           isset($data['ShopID']) && $this->data->ShopID = (int)$data['ShopID'];
           isset($data['UserID']) && $this->data->UserID = (int)$data['UserID'];
    }
}
?>